package ${package.ServiceImpl};

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import github.sf.fw.model.BaseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.Setter;
import java.util.List;

/**
 * ${table.comment!}服务
 *
 * @author ${author}
 * @since ${date}
 */
@Service
@Setter(onMethod_ = {@Autowired})
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
</#if>
    private ${table.mapperName} ${table.mapperName?uncap_first};

    /**
     * 单条记录查询
     *
     * @param ${entity?uncap_first} 条件
     * @return 记录
     */
    @Override
    public ${entity} query(${entity} ${entity?uncap_first}) {
        return ${table.mapperName?uncap_first}.query(${entity?uncap_first});
    }

    /**
     * 分页查询
     *
     * @param query 查询参数
     * @return 分页数据
     */
    @Override
    public Page${r'<'}${entity}> paging(BaseBean${r'<'}${entity}> query) {
        Page${r'<'}${entity}> page = new Page${r'<'}>(query.getPageNo(),query.getPageSize());
        return ${table.mapperName?uncap_first}.listWithCond(page,query.getLoad());
    }

    /**
     * 通用列表查询
     *
     * @param ${table.entityName?uncap_first} 查询条件
     * @return 列表
     */
    @Override
    public List<${table.entityName}> listWithCond(${entity} ${entity?uncap_first}){
        return ${table.mapperName?uncap_first}.listWithCond(${entity?uncap_first});
    }

    /**
     * 删除一条
     *
     * @param ${entity?uncap_first} 参数
     * @return 影响条数
     */
    @Override
    public int deleteWithCond(${entity} ${entity?uncap_first}) {
        return ${table.mapperName?uncap_first}.deleteWithCond(${entity?uncap_first});
    }
}
